package com.lq.educationsystem.common.util;

import java.util.List;
import java.util.Objects;

public class ResultPage<T> {
    //状态码
    private  int code;
    //消息
    private String message;
    //页数
    private int page;
    //页面大小
    private int pageSize;
    //总数
    private int countTotal;

    //返回数据
    private List<T> data;

    //总页数
    private int pageTotal;

    @Override
    public String toString() {
        return "ResultPage{" +
                "code=" + code +
                ", message='" + message + '\'' +
                ", page=" + page +
                ", pageSize=" + pageSize +
                ", countTotal=" + countTotal +
                ", data=" + data +
                ", pageTotal=" + pageTotal +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ResultPage<?> that = (ResultPage<?>) o;
        return code == that.code && page == that.page && pageSize == that.pageSize && countTotal == that.countTotal && pageTotal == that.pageTotal && Objects.equals(message, that.message) && Objects.equals(data, that.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(code, message, page, pageSize, countTotal, data, pageTotal);
    }

    public ResultPage() {
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCountTotal() {
        return countTotal;
    }

    public void setCountTotal(int countTotal) {
        this.countTotal = countTotal;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }
}
